package person.bing.fbcloud.leetcode;

/**
 * @author: mengfanbing
 * @date: 2020/7/27 9:36
 */
public class Q392 {
    public static void main(String[] args) {
        boolean subsequence = isSubsequence("aaaaaa", "bbaaaa");
        System.out.println(subsequence);
    }

    public static boolean isSubsequence(String s, String t) {
        char[] chars = s.toCharArray();
        int index = 0;
        for (char ch:chars){
            int i = t.indexOf(ch,index);
            if (i==-1){
                return false;
            }else {
                index = i+1;
            }
        }
        return true;

    }
}
